select();
function select() {
    $.ajax({
        type: "post",
        dataType: "json",
        url: "/JsKeyWordHeatStatistics/selectKeyWords",
        success: function (data) {
            var type = new Array();
            var count = new Array();
            var list = data.data;
            $("#title").append("<td>关键字名称</td>");
            $("#sum").append("<td>搜索次数</td>");
            for (var i = 0; i < list.length; i++) {
                $("#title").append("<td>" + list[i].searchKeywords + "</td>");
                $("#sum").append("<td>" + list[i].countNum + "</td>");
                type.push(list[i].searchKeywords);
                count.push(list[i].countNum);
            }
            echart(type, count, "关键字");
        }
    })
};

var myChar = echarts.init(document.getElementById('main'));

function echart(type, count, name) {
    var option = {
        title: {
            text: '订单统计图',
            subtext: '思云产品'
        },
        legend: {
            show: true
        },
        yAxis: {
            type: 'value',
            position: 'left',
        },
        xAxis: {
            data: type
        },
        series: [
            {
                name: name,
                type: 'bar',
                data: count,
                markPoint: {
                    data: [
                        {type: 'max', name: 'Max'},
                        {type: 'min', name: 'Min'}
                    ]
                }
            }
        ]
    }
    myChar.setOption(option);
};
